package org.omg.IIOP;

//
// Helper class for : ProfileBody_1_1
//
// @author OpenORB Compiler
//
public class ProfileBody_1_1Helper
{

	//
	// Insert ProfileBody_1_1 into an any
	// @param	a an any
	// @param	t ProfileBody_1_1 value
	//
	public static void insert( org.omg.CORBA.Any a, org.omg.IIOP.ProfileBody_1_1 t )
	{
		a.insert_Streamable( new org.omg.IIOP.ProfileBody_1_1Holder( t ));
	}

	//
	// Extract ProfileBody_1_1 from an any
	// @param	a an any
	// @return the extracted ProfileBody_1_1 value
	//
	public static org.omg.IIOP.ProfileBody_1_1 extract( org.omg.CORBA.Any a )
	{
		return read(a.create_input_stream());
	}

	//
	// Internal TypeCode value
	//
	private static org.omg.CORBA.TypeCode _tc = null;
	private static boolean _working = false;

	//
	// Return the ProfileBody_1_1 TypeCode
	// @return a TypeCode
	//
	public static org.omg.CORBA.TypeCode type()
	{
		if ( _tc == null ) {
			synchronized(org.omg.CORBA.TypeCode.class) {
				if ( _tc != null )
					return _tc;
				if ( _working )
					return org.omg.CORBA.ORB.init().create_recursive_tc( id() );
				_working = true;
				org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
				org.omg.CORBA.StructMember []_members = new org.omg.CORBA.StructMember[5];

				_members[0] = new org.omg.CORBA.StructMember();
				_members[0].name = "iiop_version";
				_members[0].type = org.omg.IIOP.VersionHelper.type();
				_members[1] = new org.omg.CORBA.StructMember();
				_members[1].name = "host";
				_members[1].type = orb.get_primitive_tc( org.omg.CORBA.TCKind.tk_string );
				_members[2] = new org.omg.CORBA.StructMember();
				_members[2].name = "port";
				_members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ushort);
				_members[3] = new org.omg.CORBA.StructMember();
				_members[3].name = "object_key";
				_members[3].type = org.omg.IIOP.OctetSeqHelper.type();
				_members[4] = new org.omg.CORBA.StructMember();
				_members[4].name = "components";
				_members[4].type = org.omg.IOP_N.TaggedComponentSeqHelper.type();
				_tc = orb.create_struct_tc(id(),"ProfileBody_1_1",_members);
				_working = false;
			}
		}
		return _tc;
	}

	//
	// Return the ProfileBody_1_1 IDL ID
	// @return an ID
	//
	public static String id()
	{
		return _id;
	}

	private final static String _id = "IDL:omg.org/IIOP/ProfileBody_1_1:1.0";

	//
	// Read ProfileBody_1_1 from a marshalled stream
	// @param	istream the input stream
	// @return the readed ProfileBody_1_1 value
	//
	public static org.omg.IIOP.ProfileBody_1_1 read( org.omg.CORBA.portable.InputStream istream )
	{
		org.omg.IIOP.ProfileBody_1_1 new_one = new org.omg.IIOP.ProfileBody_1_1();

		new_one.iiop_version = org.omg.IIOP.VersionHelper.read(istream);
		new_one.host = istream.read_string();
		new_one.port = istream.read_ushort();
		new_one.object_key = org.omg.IIOP.OctetSeqHelper.read(istream);
		new_one.components = org.omg.IOP_N.TaggedComponentSeqHelper.read(istream);

		return new_one;
	}

	//
	// Write ProfileBody_1_1 into a marshalled stream
	// @param	ostream the output stream
	// @param	value ProfileBody_1_1 value
	//
	public static void write( org.omg.CORBA.portable.OutputStream ostream, org.omg.IIOP.ProfileBody_1_1 value )
	{
		org.omg.IIOP.VersionHelper.write(ostream,value.iiop_version);
		ostream.write_string(value.host);
		ostream.write_ushort(value.port);
		org.omg.IIOP.OctetSeqHelper.write(ostream,value.object_key);
		org.omg.IOP_N.TaggedComponentSeqHelper.write(ostream,value.components);
	}

}
